package com.wuzao.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//Rest模式
@RestController
@RequestMapping("/api")
public class BookController {


        @ApiOperation("获取用户信息")
        @ApiImplicitParams({
                @ApiImplicitParam(name = "id", value = "用户ID", dataType = "Long", paramType = "path", example = "1")
        })
        @GetMapping("/users/{id}")
        public String getUser(@PathVariable Long id) {
            // 根据用户ID查询用户信息
            // ...
            return "nihao";
        }

        @ApiOperation("创建用户")
        @ApiImplicitParams({
                @ApiImplicitParam(name = "username", value = "用户名", dataType = "String", paramType = "query"),
                @ApiImplicitParam(name = "password", value = "密码", dataType = "String", paramType = "query")
        })
        @GetMapping("/users")
        public User createUser(String username, String password) {
            // 创建用户
            // ...

    }

}
